load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")

package(default_visibility = ["//visibility:public"])

bool_flag(
    name = "shared_object",
    build_setting_default = False,
)

bool_flag(
    name = "c_shared_object",
    build_setting_default = False,
)

bool_flag(
    name = "cc_shared_object",
    build_setting_default = False,
)

bool_flag(
    name = "has_exception",
    build_setting_default = False,
)

bool_flag(
    name = "has_rtti",
    build_setting_default = False,
)

bool_flag(
    name = "has_openmp",
    build_setting_default = False,
)

bool_flag(
    name = "has_intel_openmp",
    build_setting_default = False,
)

bool_flag(
    name = "has_avx512",
    build_setting_default = False,
)

bool_flag(
    name = "has_matplotlib",
    build_setting_default = False,
)

bool_flag(
    name = "has_numa",
    build_setting_default = False,
)

bool_flag(
    name = "has_asm_prime_field",
    build_setting_default = True,
)

bool_flag(
    name = "py_binding",
    build_setting_default = False,
)

bool_flag(
    name = "node_binding",
    build_setting_default = False,
)

config_setting(
    name = "linux_x86_64",
    constraint_values = [
        "@platforms//os:linux",
        "@platforms//cpu:x86_64",
    ],
)

config_setting(
    name = "linux_aarch64",
    constraint_values = [
        "@platforms//os:linux",
        "@platforms//cpu:aarch64",
    ],
)

config_setting(
    name = "linux_ppc",
    constraint_values = [
        "@platforms//os:linux",
        "@platforms//cpu:ppc",
    ],
)

config_setting(
    name = "linux_s390x",
    constraint_values = [
        "@platforms//os:linux",
        "@platforms//cpu:s390x",
    ],
)

config_setting(
    name = "macos_x86_64",
    constraint_values = [
        "@platforms//os:macos",
        "@platforms//cpu:x86_64",
    ],
)

config_setting(
    name = "macos_aarch64",
    constraint_values = [
        "@platforms//os:macos",
        "@platforms//cpu:aarch64",
    ],
)

config_setting(
    name = "optimized",
    values = {"compilation_mode": "opt"},
)

config_setting(
    name = "tachyon_shared_object",
    flag_values = {":shared_object": "true"},
)

config_setting(
    name = "tachyon_c_shared_object",
    flag_values = {":c_shared_object": "true"},
)

config_setting(
    name = "tachyon_cc_shared_object",
    flag_values = {":cc_shared_object": "true"},
)

config_setting(
    name = "tachyon_has_exception",
    flag_values = {":has_exception": "true"},
)

config_setting(
    name = "tachyon_has_rtti",
    flag_values = {":has_rtti": "true"},
)

config_setting(
    name = "tachyon_has_openmp",
    flag_values = {":has_openmp": "true"},
)

config_setting(
    name = "tachyon_has_intel_openmp",
    flag_values = {
        ":has_openmp": "true",
        ":has_intel_openmp": "true",
    },
)

config_setting(
    name = "tachyon_has_openmp_on_macos",
    constraint_values = [
        "@platforms//os:macos",
    ],
    flag_values = {
        ":has_openmp": "true",
    },
)

config_setting(
    name = "tachyon_has_avx512",
    constraint_values = ["@platforms//cpu:x86_64"],
    flag_values = {":has_avx512": "true"},
)

config_setting(
    name = "tachyon_has_matplotlib",
    flag_values = {":has_matplotlib": "true"},
)

config_setting(
    name = "tachyon_has_numa",
    flag_values = {"has_numa": "true"},
)

config_setting(
    name = "tachyon_has_asm_prime_field",
    flag_values = {"has_asm_prime_field": "true"},
)

config_setting(
    name = "tachyon_py_binding",
    flag_values = {"py_binding": "true"},
)

config_setting(
    name = "tachyon_node_binding",
    flag_values = {"node_binding": "true"},
)

buildifier(
    name = "buildifier",
)
